using System;
using System.Collections.Generic;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;
using OracleInternal.I18N;
using OracleInternal.TTC;
using OracleInternal.TTC.Accessors;

namespace OracleInternal.ServiceObjects
{
	internal class OracleClobImpl
	{
		internal OracleConnectionImpl m_connectionImpl;

		internal byte[] m_lobLocator;

		internal string m_lobId;

		internal TTCClob m_ttcClob;

		internal bool m_isNClob;

		internal bool m_bCache;

		internal int m_chunkSize;

		internal int m_optimumChunkSize;

		internal long m_totalLobSize;

		internal bool m_bDbVaryingWidth;

		internal short m_clobCharSet;

		internal byte m_clobFormOfUse;

		internal int m_lobDataLength;

		internal bool m_isTemporaryLob;

		internal bool m_doneTempLobCreate;

		internal bool m_isEmpty;

		internal byte[] m_lobPrefetchData;

		private string m_id;

		internal int m_refCount = 1;

		private object m_lock = new object();

		internal bool IsCompleteDataPrefetched
		{
			get
			{
				if (m_lobPrefetchData != null)
				{
					int num = (m_isNClob ? m_connectionImpl.m_marshallingEngine.m_nCharSetConv.MaxBytesPerChar : m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.MaxBytesPerChar);
					if (num <= 0)
					{
						return false;
					}
					return m_lobDataLength / num >= m_totalLobSize;
				}
				return false;
			}
		}

		internal bool IsValueLob
		{
			get
			{
				bool result = false;
				if (m_lobLocator != null)
				{
					result = TTCLob.IsValueBasedLocator(m_lobLocator);
				}
				return result;
			}
		}

		internal bool IsQuasiLobLocator
		{
			get
			{
				bool result = false;
				if (m_lobLocator != null)
				{
					result = TTCLob.IsQuasiLocator(m_lobLocator);
				}
				return result;
			}
		}

		internal OracleClobImpl(OracleConnectionImpl connImpl, byte[] lobLocator, bool bNClob, bool bCache)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor);
			}
			try
			{
				m_id = GetHashCode().ToString();
				m_connectionImpl = connImpl;
				m_lobLocator = lobLocator;
				m_isNClob = bNClob;
				m_bCache = bCache;
				m_ttcClob = new TTCClob(connImpl.m_marshallingEngine);
				if (m_lobLocator != null)
				{
					m_lobId = GetLobIdString(m_lobLocator);
					if (IsTemporaryLob(m_lobLocator))
					{
						m_connectionImpl.TemporaryLobReferenceAdd(m_lobId, this);
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, "(implid={0})", m_id);
				}
			}
		}

		internal OracleClobImpl(OracleConnectionImpl connImpl, byte[] lobLocator, bool bNClob)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor);
			}
			try
			{
				m_id = GetHashCode().ToString();
				m_connectionImpl = connImpl;
				m_lobLocator = lobLocator;
				m_isNClob = bNClob;
				m_ttcClob = new TTCClob(connImpl.m_marshallingEngine);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, "(implid={0})", m_id);
				}
			}
		}

		internal OracleClobImpl(int currentRow, OracleConnectionImpl connImpl, TTCLobAccessor lobAccessor)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor);
			}
			try
			{
				m_id = GetHashCode().ToString();
				m_connectionImpl = connImpl;
				m_lobDataLength = (int)lobAccessor.m_prefetchInfo.m_prefetchedDataLength[currentRow];
				m_totalLobSize = lobAccessor.m_prefetchInfo.m_totalLobSizeInDB[currentRow];
				m_isNClob = lobAccessor.m_prefetchInfo.m_clobFormOfUse == 2;
				m_lobLocator = lobAccessor.GetLobLocator(currentRow);
				List<ArraySegment<byte>> list = lobAccessor.m_prefetchInfo.m_prefetchedData[currentRow];
				if (list != null)
				{
					m_lobPrefetchData = new byte[m_lobDataLength];
					Accessor.CopyDataToUserBuffer(list, 0, m_lobPrefetchData, 0, m_lobDataLength);
				}
				m_ttcClob = new TTCClob(connImpl.m_marshallingEngine);
				m_isTemporaryLob = TTCLob.IsTemporaryLob(m_lobLocator);
				if (m_isTemporaryLob)
				{
					m_doneTempLobCreate = true;
				}
				m_lobId = GetLobIdString(m_lobLocator);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, "(implid={0})", m_id);
				}
			}
		}

		internal OracleClobImpl(OracleConnectionImpl connImpl, TTCLobAccessor lobAccessor, DataUnmarshaller dataUnmarshaller, int currentRow, int columnIndex)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor);
			}
			try
			{
				m_id = GetHashCode().ToString();
				m_connectionImpl = connImpl;
				m_isNClob = lobAccessor.m_colMetaData.m_characterSetForm == 2;
				lobAccessor.GetLobData(dataUnmarshaller, currentRow, columnIndex, out m_lobLocator, out var prefetchCtx);
				if (prefetchCtx != null)
				{
					m_lobPrefetchData = prefetchCtx.m_lobPrefetchData;
					m_chunkSize = prefetchCtx.m_chunkSize;
					m_clobCharSet = prefetchCtx.m_clobCharSet;
					m_clobFormOfUse = prefetchCtx.m_clobFormOfUse;
					m_bDbVaryingWidth = prefetchCtx.m_bDbVaryingWidth;
					m_lobDataLength = prefetchCtx.m_lobDataLength;
					m_totalLobSize = prefetchCtx.m_totalLobSize;
				}
				m_ttcClob = new TTCClob(connImpl.m_marshallingEngine);
				m_isTemporaryLob = TTCLob.IsTemporaryLob(m_lobLocator);
				if (m_isTemporaryLob)
				{
					m_doneTempLobCreate = true;
				}
				m_lobId = GetLobIdString(m_lobLocator);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ctor, "(implid={0})", m_id);
				}
			}
		}

		internal long GetLength()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetLength, "(implid={0})", m_id);
			}
			try
			{
				if (m_lobPrefetchData != null)
				{
					return m_totalLobSize;
				}
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					return m_ttcClob.GetLength(m_lobLocator);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetLength, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetLength, "(implid={0})", m_id);
				}
			}
		}

		internal long SetLength(long newLength)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.SetLength, "(implid={0})", m_id);
			}
			try
			{
				long result;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					result = m_ttcClob.Trim(m_lobLocator, newLength);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				m_lobPrefetchData = null;
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.SetLength, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.SetLength, "(implid={0})", m_id);
				}
			}
		}

		internal bool Open()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Open, "(implid={0})", m_id);
			}
			try
			{
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					return m_ttcClob.Open(m_lobLocator, 2);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Open, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Open, "(implid={0})", m_id);
				}
			}
		}

		internal bool Close()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Close, "(implid={0})", m_id);
			}
			bool result = true;
			try
			{
				if (m_lobLocator != null)
				{
					try
					{
						m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
						if (m_lobLocator != null)
						{
							result = m_ttcClob.Close(m_lobLocator);
						}
					}
					finally
					{
						m_connectionImpl.m_connectionFreeToUseEvent.Set();
					}
				}
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Close, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Close, "(implid={0})", m_id);
				}
			}
		}

		internal void CreateTemporaryLob()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CreateTemporaryLob, "(implid={0})", m_id);
			}
			try
			{
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					m_lobLocator = m_ttcClob.CreateTemporaryLob(m_bCache, m_isNClob, 10);
					m_lobId = GetLobIdString(m_lobLocator);
					m_connectionImpl.TemporaryLobReferenceAdd(m_lobId, this);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CreateTemporaryLob, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CreateTemporaryLob, "(implid={0})", m_id);
				}
			}
		}

		internal void FreeTemporaryLob()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.FreeTemporaryLob, "(implid={0})", m_id);
			}
			try
			{
				if (m_lobLocator == null)
				{
					return;
				}
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					if (m_lobLocator != null)
					{
						m_connectionImpl.AddAllPiggyBackRequests();
						m_ttcClob.FreeTemporaryLob(m_lobLocator);
						m_lobLocator = null;
					}
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.FreeTemporaryLob, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.FreeTemporaryLob, "(implid={0})", m_id);
				}
			}
		}

		internal bool IsTemporaryLob()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.IsTemporaryLob, "(implid={0})", m_id);
			}
			bool result = true;
			try
			{
				if (m_lobLocator != null)
				{
					result = IsTemporaryLob(m_lobLocator);
				}
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.IsTemporaryLob, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.IsTemporaryLob, "(implid={0})", m_id);
				}
			}
		}

		internal long GetChunkSize()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetChunkSize, "(implid={0})", m_id);
			}
			try
			{
				if (m_lobPrefetchData != null)
				{
					return m_chunkSize;
				}
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					return m_ttcClob.GetChunkSize(m_lobLocator);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetChunkSize, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetChunkSize, "(implid={0})", m_id);
				}
			}
		}

		internal static long GetClobDataInChars(int currentRow, OracleConnectionImpl connImpl, byte[] lobLocator, TTCLobAccessor lobAccessor, long locatorOffset, char[] outBuffer, int outBufferOffset, int numCharsToCopy)
		{
			int charCount = 0;
			int num = 0;
			bool flag = false;
			bool bIsNClob = false;
			long prefetchedDataLength = 0L;
			long dataLengthInDB = 0L;
			List<ArraySegment<byte>> prefetchedData = null;
			lobAccessor.GetLOBPrefetchInfo(currentRow, out prefetchedData, out prefetchedDataLength, out dataLengthInDB, out bIsNClob);
			byte b = 0;
			b = ((lobLocator == null) ? Accessor.GetValueAt(lobAccessor.m_lobLocators[currentRow], 6) : lobLocator[6]);
			if ((b & 0x80) == 128)
			{
				flag = true;
			}
			if (prefetchedData != null)
			{
				if (locatorOffset <= prefetchedDataLength)
				{
					int num2 = 0;
					for (int i = 0; i < prefetchedData.Count; i++)
					{
						num2 += prefetchedData[i].Count;
					}
					if (flag)
					{
						charCount = numCharsToCopy;
						Conv.GetInstance(2000).ConvertBytesToChars(prefetchedData, (int)locatorOffset - 1, num2, outBuffer, outBufferOffset, ref charCount);
					}
					else
					{
						charCount = numCharsToCopy;
						if (!bIsNClob)
						{
							connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToChars(prefetchedData, (int)locatorOffset - 1, num2, outBuffer, outBufferOffset, ref charCount);
						}
						else
						{
							connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToChars(prefetchedData, (int)locatorOffset - 1, num2, outBuffer, outBufferOffset, ref charCount);
						}
					}
					if (charCount >= numCharsToCopy || charCount == dataLengthInDB)
					{
						return charCount;
					}
					outBufferOffset += charCount;
					numCharsToCopy -= charCount;
					locatorOffset = 1L;
				}
				else
				{
					locatorOffset -= prefetchedDataLength;
				}
			}
			num = charCount;
			if (num < dataLengthInDB)
			{
				List<ArraySegment<byte>> list = lobAccessor.m_dataThroughLobArrayRead[currentRow];
				int num3 = 0;
				for (int j = 0; j < list.Count; j++)
				{
					num3 += list[j].Count;
				}
				if (flag)
				{
					charCount = numCharsToCopy;
					Conv.GetInstance(2000).ConvertBytesToChars(list, (int)locatorOffset - 1, num3, outBuffer, outBufferOffset, ref charCount);
				}
				else
				{
					charCount = numCharsToCopy;
					if (!bIsNClob)
					{
						connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToChars(list, (int)locatorOffset - 1, num3, outBuffer, outBufferOffset, ref charCount);
					}
					else
					{
						connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToChars(list, (int)locatorOffset - 1, num3, outBuffer, outBufferOffset, ref charCount);
					}
				}
				num += charCount;
			}
			return num;
		}

		internal static string GetCompleteClobData(int currentRow, DataUnmarshaller dataUnmarshaller, OracleConnectionImpl connImpl, byte[] lobLocator, TTCLobAccessor lobAccessor)
		{
			string text = string.Empty;
			bool flag = false;
			bool bIsNClob = false;
			long prefetchedDataLength = 0L;
			long dataLengthInDB = 0L;
			List<ArraySegment<byte>> prefetchedData = null;
			lobAccessor.GetLOBPrefetchInfo(currentRow, out prefetchedData, out prefetchedDataLength, out dataLengthInDB, out bIsNClob);
			byte b = 0;
			b = ((lobLocator == null) ? Accessor.GetValueAt(lobAccessor.m_lobLocators[currentRow], 6) : lobLocator[6]);
			if ((b & 0x80) == 128)
			{
				flag = true;
			}
			char[] array = null;
			if (prefetchedDataLength > 0)
			{
				if (flag)
				{
					Conv instance = Conv.GetInstance(2000);
					array = dataUnmarshaller.GetCharArrayForConversion(prefetchedDataLength, instance);
					text = instance.ConvertBytesToString(prefetchedData, array);
				}
				else if (!bIsNClob)
				{
					array = dataUnmarshaller.GetCharArrayForConversion(prefetchedDataLength, connImpl.m_marshallingEngine.m_dbCharSetConv);
					text = connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToString(prefetchedData, array);
				}
				else
				{
					array = dataUnmarshaller.GetCharArrayForConversion(prefetchedDataLength, connImpl.m_marshallingEngine.m_nCharSetConv);
					text = connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToString(prefetchedData, array);
				}
			}
			if (text.Length < dataLengthInDB)
			{
				List<ArraySegment<byte>> bytes = lobAccessor.m_dataThroughLobArrayRead[currentRow];
				if (flag)
				{
					Conv instance2 = Conv.GetInstance(2000);
					array = dataUnmarshaller.GetCharArrayForConversion(dataLengthInDB - prefetchedDataLength, instance2);
					text += instance2.ConvertBytesToString(bytes, array);
				}
				else if (!bIsNClob)
				{
					array = dataUnmarshaller.GetCharArrayForConversion(dataLengthInDB - prefetchedDataLength, connImpl.m_marshallingEngine.m_dbCharSetConv);
					text += connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToString(bytes, array);
				}
				else
				{
					array = dataUnmarshaller.GetCharArrayForConversion(dataLengthInDB - prefetchedDataLength, connImpl.m_marshallingEngine.m_nCharSetConv);
					text += connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToString(bytes, array);
				}
			}
			return text;
		}

		internal static string GetCompleteClobData(int currentRow, int columnIndex, OracleConnectionImpl connImpl, byte[] lobLocator, DataUnmarshaller dataUnmarshaller, TTCLobAccessor lobAccessor, ref OracleClobImpl oraClobImpl)
		{
			string text = string.Empty;
			if (!lobAccessor.m_bNullByDescribe)
			{
				long num = 0L;
				bool flag = false;
				byte b = 0;
				long num2 = 0L;
				long locatorOffset = 0L;
				long num3 = 0L;
				if (lobLocator == null)
				{
					lobLocator = lobAccessor.GetLobLocator(currentRow);
				}
				if (lobLocator != null)
				{
					List<ArraySegment<byte>> list = new List<ArraySegment<byte>>();
					dataUnmarshaller.StartAccumulatingColumnData(currentRow, columnIndex, list);
					long internalInitialLOBFS = lobAccessor.m_internalInitialLOBFS;
					int length = 0;
					char[] array = null;
					if (lobAccessor.m_marshallingEngine.DBVersion >= 11100)
					{
						dataUnmarshaller.UnmarshalUB4();
						num = dataUnmarshaller.UnmarshalSB8();
						dataUnmarshaller.UnmarshalUB4();
						if (lobAccessor.m_internalInitialLOBFS > 0)
						{
							internalInitialLOBFS = num;
							if (1 == dataUnmarshaller.UnmarshalUB1())
							{
								flag = true;
							}
							if (flag)
							{
								dataUnmarshaller.UnmarshalUB2();
							}
							b = (byte)dataUnmarshaller.UnmarshalUB1();
							long num4 = 0L;
							num4 = (flag ? (internalInitialLOBFS * 2) : ((1 != b) ? (internalInitialLOBFS * connImpl.m_marshallingEngine.m_nCharSetConv.MaxBytesPerChar) : (internalInitialLOBFS * connImpl.m_marshallingEngine.m_dbCharSetConv.MaxBytesPerChar)));
							num2 = (int)((num4 < int.MaxValue) ? num4 : int.MaxValue);
							dataUnmarshaller.UnmarshalCLR_ScanOnly((int)num2, ref length);
							if (flag)
							{
								Conv instance = Conv.GetInstance(2000);
								array = dataUnmarshaller.GetCharArrayForConversion(length, instance);
								text = instance.ConvertBytesToString(list, array);
							}
							else if (lobAccessor.m_colMetaData.m_characterSetForm == 1)
							{
								array = dataUnmarshaller.GetCharArrayForConversion(length, connImpl.m_marshallingEngine.m_dbCharSetConv);
								text = connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToString(list, array);
							}
							else
							{
								array = dataUnmarshaller.GetCharArrayForConversion(length, connImpl.m_marshallingEngine.m_nCharSetConv);
								text = connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToString(list, array);
							}
						}
						if (num > lobAccessor.m_internalInitialLOBFS)
						{
							locatorOffset = lobAccessor.m_internalInitialLOBFS + 1;
							num3 = num - lobAccessor.m_internalInitialLOBFS;
						}
						if (num3 > 0)
						{
							if (oraClobImpl == null)
							{
								oraClobImpl = new OracleClobImpl(connImpl, lobLocator, lobAccessor.m_colMetaData.m_characterSetForm == 2);
							}
							else
							{
								oraClobImpl.m_lobLocator = lobLocator;
								oraClobImpl.m_clobFormOfUse = (byte)lobAccessor.m_colMetaData.m_characterSetForm;
								oraClobImpl.m_isNClob = lobAccessor.m_colMetaData.m_characterSetForm == 2;
							}
						}
					}
					else
					{
						if (oraClobImpl == null)
						{
							oraClobImpl = new OracleClobImpl(connImpl, lobLocator, lobAccessor.m_colMetaData.m_characterSetForm == 2);
						}
						else
						{
							oraClobImpl.m_lobLocator = lobLocator;
							oraClobImpl.m_clobFormOfUse = (byte)lobAccessor.m_colMetaData.m_characterSetForm;
							oraClobImpl.m_isNClob = lobAccessor.m_colMetaData.m_characterSetForm == 2;
						}
						num = oraClobImpl.GetLength();
						locatorOffset = 1L;
						num3 = num;
					}
					if (num3 > 0)
					{
						connImpl.m_marshallingEngine.m_oraBufRdr.m_bHoldOBTemporarily = true;
						oraClobImpl.ReadDataFromDB(locatorOffset, num3, list);
						if ((lobLocator[6] & 0x80) == 128)
						{
							flag = true;
						}
						if (flag)
						{
							Conv instance2 = Conv.GetInstance(2000);
							array = dataUnmarshaller.GetCharArrayForConversion(num3, instance2);
							text += Conv.GetInstance(2000).ConvertBytesToString(list, array);
						}
						else if (lobAccessor.m_colMetaData.m_characterSetForm == 1)
						{
							array = dataUnmarshaller.GetCharArrayForConversion(num3, connImpl.m_marshallingEngine.m_dbCharSetConv);
							text += connImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToString(list, array);
						}
						else
						{
							array = dataUnmarshaller.GetCharArrayForConversion(num3, connImpl.m_marshallingEngine.m_nCharSetConv);
							text += connImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToString(list, array);
						}
						connImpl.m_marshallingEngine.m_oraBufRdr.m_bHoldOBTemporarily = false;
					}
					dataUnmarshaller.StopAccumulatingColumnData();
				}
			}
			return text;
		}

		internal void ReadDataFromDB(long locatorOffset, long numCharsToRead, List<ArraySegment<byte>> dataSegments)
		{
			try
			{
				m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
				m_connectionImpl.AddAllPiggyBackRequests();
				m_ttcClob.Read(m_lobLocator, locatorOffset, numCharsToRead, dataSegments);
			}
			finally
			{
				m_connectionImpl.m_connectionFreeToUseEvent.Set();
			}
		}

		internal long Read(long locatorOffset, long numCharsToRead, long outBufferOffset, ref char[] outBuffer)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, "(implid={0})", m_id);
			}
			int charCount = 0;
			bool flag = false;
			if ((m_lobLocator[6] & 0x80) == 128)
			{
				flag = true;
			}
			try
			{
				if (m_lobPrefetchData != null)
				{
					int lobDataLength = m_lobDataLength;
					if (locatorOffset <= lobDataLength)
					{
						if (flag)
						{
							charCount = (int)numCharsToRead;
							Conv.GetInstance(2000).ConvertBytesToChars(m_lobPrefetchData, (int)locatorOffset - 1, m_lobDataLength, outBuffer, (int)outBufferOffset, ref charCount);
						}
						else
						{
							charCount = (int)numCharsToRead;
							if (!m_isNClob)
							{
								m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToChars(m_lobPrefetchData, (int)locatorOffset - 1, m_lobDataLength, outBuffer, (int)outBufferOffset, ref charCount);
							}
							else
							{
								m_connectionImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToChars(m_lobPrefetchData, (int)locatorOffset - 1, m_lobDataLength, outBuffer, (int)outBufferOffset, ref charCount);
							}
						}
						if (charCount >= numCharsToRead || IsCompleteDataPrefetched || charCount >= m_totalLobSize)
						{
							return charCount;
						}
						outBufferOffset += charCount;
						numCharsToRead -= charCount;
						locatorOffset += charCount;
					}
				}
				byte[] outBuffer2 = null;
				long num;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					num = m_ttcClob.Read(m_lobLocator, locatorOffset, numCharsToRead, flag, out outBuffer2);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				charCount += ConvertBytesToChars(outBuffer2, 0, (int)num, outBuffer, (int)outBufferOffset, flag);
				return charCount;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, "(implid={0})", m_id);
				}
			}
		}

		internal int ConvertBytesToChars(byte[] dataBuffer, int dataStartIdx, int numBytesToConvert, char[] outBuffer, int outBufferOffset, bool bVariableWidthChar)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ConvertBytesToChars, "(implid={0})", m_id);
			}
			int charCount = outBuffer.Length;
			try
			{
				if (!bVariableWidthChar)
				{
					numBytesToConvert = (m_isNClob ? m_connectionImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToChars(dataBuffer, dataStartIdx, numBytesToConvert, outBuffer, outBufferOffset, ref charCount) : m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToChars(dataBuffer, dataStartIdx, numBytesToConvert, outBuffer, outBufferOffset, ref charCount));
				}
				else
				{
					Conv.GetInstance(2000).ConvertBytesToChars(dataBuffer, dataStartIdx, numBytesToConvert, outBuffer, outBufferOffset, ref charCount);
				}
				return charCount;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ConvertBytesToChars, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.ConvertBytesToChars, "(implid={0})", m_id);
				}
			}
		}

		internal long Read(long position, long locatorOffset, long numChars, long outBufferOffset, ref byte[] outBuffer)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, "(implid={0})", m_id);
			}
			long num = 0L;
			byte[] outBuffer2 = null;
			bool flag = false;
			if ((m_lobLocator[6] & 0x80) == 128)
			{
				flag = true;
			}
			if (numChars == 0L)
			{
				numChars++;
			}
			bool flag2 = false;
			if (position > 0 && position % 2 != 0L)
			{
				flag2 = true;
			}
			try
			{
				if (m_lobPrefetchData != null)
				{
					int lobDataLength = m_lobDataLength;
					if (locatorOffset <= lobDataLength)
					{
						int num2 = (int)(lobDataLength - (locatorOffset - 1));
						int num3 = (int)((num2 < numChars) ? num2 : numChars);
						byte[] array = (flag ? Conv.GetInstance(2000).ConvertBytesToUTF16(m_lobPrefetchData, (int)(locatorOffset - 1), num3) : (m_isNClob ? m_connectionImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToUTF16(m_lobPrefetchData, (int)(locatorOffset - 1), num3) : m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToUTF16(m_lobPrefetchData, (int)(locatorOffset - 1), num3)));
						long num4 = outBuffer.Length - outBufferOffset;
						if (num4 >= array.Length)
						{
							num4 = array.Length;
						}
						Buffer.BlockCopy(array, 0, outBuffer, (int)outBufferOffset, (int)num4);
						if (numChars <= num3 || IsCompleteDataPrefetched || num3 >= m_totalLobSize)
						{
							return num3;
						}
						outBufferOffset += num4;
						numChars -= num3;
						locatorOffset += num3;
					}
				}
				long num5;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					num5 = m_ttcClob.Read(m_lobLocator, locatorOffset, numChars, flag, out outBuffer2);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				int num6 = (flag2 ? 1 : 0);
				byte[] array2 = (flag ? Conv.GetInstance(2000).ConvertBytesToUTF16(outBuffer2, 0, (int)num5) : (m_isNClob ? m_connectionImpl.m_marshallingEngine.m_nCharSetConv.ConvertBytesToUTF16(outBuffer2, 0, (int)num5) : m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.ConvertBytesToUTF16(outBuffer2, 0, (int)num5)));
				if (outBuffer.Length >= outBufferOffset + array2.Length)
				{
					Array.Copy(array2, num6, outBuffer, (int)outBufferOffset, array2.Length - num6);
					return array2.Length - num6;
				}
				Array.Copy(array2, num6, outBuffer, (int)outBufferOffset, outBuffer.Length - outBufferOffset);
				return outBuffer.Length - outBufferOffset;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Read, "(implid={0})", m_id);
				}
			}
		}

		internal long Erase(long locatorOffset, long numCharsToErase)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Erase, "(implid={0})", m_id);
			}
			try
			{
				long result;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					result = m_ttcClob.Erase(m_lobLocator, locatorOffset, numCharsToErase);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				m_lobPrefetchData = null;
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Erase, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Erase, "(implid={0})", m_id);
				}
			}
		}

		internal long Write(long locatorOffset, bool bIsNClob, byte[] inBuffer, int inBufferOffset, int numBytesToWrite)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, "(implid={0})", m_id);
			}
			bool flag = false;
			if ((m_lobLocator[6] & 0x80) == 128)
			{
				flag = true;
			}
			try
			{
				byte[] array;
				int num;
				if (flag)
				{
					array = Conv.GetInstance(2000).ConvertUTF16ToBytes(inBuffer, inBufferOffset, numBytesToWrite);
					num = array.Length / 2;
				}
				else if (!bIsNClob)
				{
					array = m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.ConvertUTF16ToBytes(inBuffer, inBufferOffset, numBytesToWrite);
					num = m_connectionImpl.m_marshallingEngine.m_dbCharSetConv.GetCharsLength(array, 0, array.Length);
				}
				else
				{
					array = m_connectionImpl.m_marshallingEngine.m_nCharSetConv.ConvertUTF16ToBytes(inBuffer, inBufferOffset, numBytesToWrite);
					num = m_connectionImpl.m_marshallingEngine.m_nCharSetConv.GetCharsLength(array, 0, array.Length);
				}
				long result;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					result = m_ttcClob.Write(m_lobLocator, bIsNClob, m_connectionImpl.m_serverNCharSet, locatorOffset, array, 0L, num, flag);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				m_lobPrefetchData = null;
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, "(implid={0})", m_id);
				}
			}
		}

		internal long Write(long locatorOffset, bool bIsNClob, char[] inBuffer, long inBufferOffset, long numCharsToWrite)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, "(implid={0})", m_id);
			}
			try
			{
				long result;
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					result = m_ttcClob.Write(m_lobLocator, bIsNClob, m_connectionImpl.m_serverNCharSet, locatorOffset, inBuffer, inBufferOffset, numCharsToWrite);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				m_lobPrefetchData = null;
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Write, "(implid={0})", m_id);
				}
			}
		}

		internal void Append(byte[] srcLobLocator)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Append, "(implid={0})", m_id);
			}
			try
			{
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					m_ttcClob.Append(srcLobLocator, m_lobLocator);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				m_lobPrefetchData = null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Append, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.Append, "(implid={0})", m_id);
				}
			}
		}

		internal long CopyTo(byte[] destLobLocator, long srcOffset, long dstOffset, long dataLen)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CopyTo, "(implid={0})", m_id);
			}
			long result = 0L;
			try
			{
				try
				{
					m_connectionImpl.m_connectionFreeToUseEvent.WaitOne();
					m_connectionImpl.AddAllPiggyBackRequests();
					result = m_ttcClob.Copy(m_lobLocator, destLobLocator, srcOffset, dstOffset, dataLen);
				}
				finally
				{
					m_connectionImpl.m_connectionFreeToUseEvent.Set();
				}
				return result;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268697600, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CopyTo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.CopyTo, "(implid={0})", m_id);
				}
			}
		}

		internal void AddRef()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.AddRef, "(implid={0}) (total={1})", m_id, m_refCount.ToString());
			}
			try
			{
				lock (m_lock)
				{
					m_refCount++;
				}
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.AddRef, "(implid={0}) (total={1})", m_id, m_refCount.ToString());
				}
			}
		}

		internal void RelRef()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.RelRef, "(implid={0}) (total={1})", m_id, m_refCount.ToString());
			}
			try
			{
				lock (m_lock)
				{
					m_refCount--;
					if (m_refCount == 0 && ((m_isTemporaryLob && m_doneTempLobCreate) || IsTemporaryLob()))
					{
						if (m_lobLocator != null)
						{
							m_connectionImpl.AddTempLOBsToBeFreed(m_lobLocator);
						}
						if (m_lobId != null)
						{
							m_connectionImpl.TemporaryLobReferenceRemove(m_lobId);
						}
					}
				}
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.RelRef, "(implid={0}) (total={1})", m_id, m_refCount.ToString());
				}
			}
		}

		internal int GetRefCount()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262400, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetRefCount, "(implid={0})", m_id);
			}
			try
			{
				return m_refCount;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)262656, OracleTraceClassName.OracleClobImpl, OracleTraceFuncName.GetRefCount, "(implid={0}) (total={1})", m_id, m_refCount.ToString());
				}
			}
		}

		internal static bool IsTemporaryLob(byte[] lobLocator)
		{
			return TTCLob.IsTemporaryLob(lobLocator);
		}

		internal static byte[] GetLobId(byte[] lobLocator)
		{
			return TTCLob.GetLobId(lobLocator);
		}

		internal static string GetLobIdString(byte[] lobLocator)
		{
			return TTCLob.GetLobIdString(lobLocator);
		}
	}
}
